<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>发药</title>
</head>
<body>
	<div style="width: 100%; height: 100%;">
		<div style="width: 100%; height: 40%">
			<table style="width: 100%; padding-top: 10px;">
				<tr>
					<td class="fayao_td"><span class="fayao_lists">发药编号* </span><input
						class="easyui-textbox"
						data-options="readonly:true,prompt:'H123',width:100
						">
					</td>
					<td class="fayao_td"><span class="fayao_lists">未处理电子处方编号:
					</span> <select id="cc" class="easyui-combogrid" name="dept"
						style="width: 400px;"
						data-options="    
					            panelWidth:400,    
								url:'getData_chufang' ,
					            method:'get',  
					            idField:'medcine_code',    
					            textField:'medcine_prople',    
					     		fitColumns:true, 
					            columns:[[
					            	{field:'medcine_code',title:'编号',width:60},    
					                {field:'medcine_name',title:'医生姓名',width:100},    
					                {field:'medcine_date',title:'处方日期',width:170},    
					                {field:'medcine_prople',title:'病人姓名',width:100},
					                {field:'medcine_state',title:'状态',width:100}    
					            ]]    
					        ">
					</select></td>
					<td class="fayao_td" style="text-align: right"><span
						class="fayao_lists">发药日期 </span><input type="text"
						class="easyui-datebox" required="required"> </input></td>
				</tr>
				<tr>
					<td class="fayao_td"><span class="fayao_lists">操作人:</span>
						<select id="cc" class="easyui-combotree" style="width:200px;"   
        					data-options="url:'get_operator_data',required:true,method:'get'">
        				</select> 
				 </td>
					<td class="fayao_td"><span class="fayao_lists">药房: </span><input
						class="easyui-textbox"
						data-options="prompt:'中药房',width:180
						"></td>
					<td class="fayao_td" style="padding-left: 54px"><span
						class="fayao_lists">总金额: </span><input class="easyui-textbox"
						data-options="prompt:'0.00',width:110
						"></td>
				</tr>
				<tr>
					<td colspan="3" style="text-align: right; padding-top: 20px">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-search'">查看</a>
					</td>
				</tr>
			</table>
			
		</div>
		<div style="height:50%;width:100%;margin-top:-20px">
		<!-- 
			处方单、药品详细单
		 -->
			<table id="dg" style="width: 100%; height: 100%"
				title="处方编号1"
				data-options="view:scrollview,rownumbers:true,singleSelect:true,autoRowHeight:false,pageSize:50,fitColumns:true">
				<thead>
					<tr>
						<th field="medcine_code" width="120">药品编号</th>
						<th field="medcine_name" width="240">药品名称</th>
						<th field="medcine_number" width="80" align="right">药品数量</th>
						<th field="medcine_company" width="80" align="center">药品单位</th>
						<th field="medcine_price" width="80" align="right">药品单价</th>
						<th field="medcine_cost" width="90" align="right">金额</th>
						<th field="medcine_state" width="90" align="center">状态</th>
						<th field="medcine_note" width="300">处方备注</th>
					</tr>
				</thead>
			</table>
			</div>
			<div style="height:10%;width:100%;padding:5px;text-align:right;padding-top:30px">
				<a class="easyui-linkbutton" data-options="iconCls:'icon-undo',toggle:true">一键发药</a>
			</div>
		<script>
			$(function() {
				var rows = [];
				for (var i = 1; i <= 200; i++) {
					rows.push({
						medcine_code : 'medcine_code ' + i,
						medcine_name : i%2==0?'莎普爱思':'杜冷丁',
						medcine_number :  i,
						medcine_company : '盒',
						medcine_price : i,
						medcine_cost : 5* 6,
						medcine_state : i%2==0?'已处理':'未处理',
						medcine_note :i%3==0?'该病人青霉素过敏':'该病人对花粉过敏'	
					});
				}
				$('#dg')
				.datagrid(
						{
							detailFormatter : function(rowIndex,
									rowData) {
								return '<table><tr>'
										+ '<td style="border:0;padding-right:10px">'
										+ '<p>Name: ' + rowData.medcine_name
										+ '</p>' + '<p>库存数量: '
										+ 200 + '</p>'
										+ '</td>'
										+ '<td style="border:0">'
										+ '<p>medcine_price: ' + rowData.medcine_price
										+ '</p>' + '<p>medcine_cost: '
										+ rowData.medcine_cost + '</p>'
										+ '</td>' + '</tr></table>';
							}
						}).datagrid('loadData', rows);
				$('#dg').datagrid({
					rowStyler:function(index,row){
						if(row.medcine_state=='未处理'){
							return 'background-color:#CCCCCC;color:#fff;';
						}
					}
				});
	});
		</script>
</body>
</html>